package com.lock;

import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.util.Log;

import com.qihoo.keepalive.KeepAliveListener;
import com.qihoo.keepalive.LiveManager;
import com.qihoo.liveinterface.InterfaceScreen;

import java.util.Map;

public class MyApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        initLiveSDK();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        LockerService.startService(this);
    }

    //  初始化保活SDK
    private void initLiveSDK() {
        LiveManager.init(this, new KeepAliveListener() {
            @Override
            public void trackEvent(String eventCode, String eventName, Map<String, Object> map) {
                Log.e("事件", eventCode + " " + eventName + " 保活：" + Build.BRAND);
            }
        });
        LiveManager.setScreenLis(new InterfaceScreen() {
            @Override
            public void actionScreenOn() {
                Log.e("TAG","开屏了");
            }

            @Override
            public void actionScreenOff() {
                Log.e("TAG","锁屏了");
            }

            @Override
            public void actionUserPresent(Context c) {
                Log.e("TAG","解锁了");
            }
        });
    }
}